home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 1809 < prev    next >
Encoding:
Text File  |  1996-08-06  |  1.3 KB  |  46 lines

  1. Path: ub239.dialup.uwa.edu.au!not-for-mail
  2. From: prye@cyllene.uwa.edu.au (Peter Rye)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: cout stupidity
  5. Date: 13 Jan 1996 01:21:25 +0800
  6. Organization: The University of Western Australia
  7. Message-ID: <4d65al$1oj@ub239.dialup.uwa.edu.au>
  8. References: <4d321g$eal@calvin.st-and.ac.uk>
  9. NNTP-Posting-Host: ub239.dialup.uwa.edu.au
  10.  
  11. ks2@st-and.ac.uk (Keith Sibson) writes:
  12.  
  13.  
  14. >#include <iostream.h>
  15.  
  16. >int count=10;
  17.  
  18. >main()
  19. >{
  20. > for(i=0;i<cout;i++) {.....}
  21. > return(0);
  22. >}
  23.  
  24. >Why does this stupidity compile? (BCC 4.5)
  25.  
  26. >Surely cout is of type ostream? Either there is a dubious operator< that 
  27. >takes an int and ostream, or there is some wacky automatic conversions going
  28. >on. Does an ostream cast to an int that is the stream position?
  29.  
  30. >Keith.
  31.  
  32. Hi Keith,
  33. Won't compile here....
  34.  
  35. Linux ub239 1.2.1 #6 Mon Nov 6 21:14:54 WST 1995 i486
  36. gcc version 2.6.3
  37.  
  38. g++ -c test.cpp
  39. ~/test.cpp: In function `int main()':
  40. ~/test.cpp:7: no match for `operator <(int, class _IO_ostream_withassign)'
  41. -- 
  42. | Peter Rye                                                           |
  43. | Respiratory Research Fellow                                         |
  44. | Princess Margaret Hospital for Children                             |
  45. | Perth, Western Australia                                            |
  46.